import Menu from "@/components/common/menu"
import React from "react";
const BusinessIndex = () => {
    const [Business] = React.useState(React.Business)

    //退出登陆
    const logout = () => {
        React.UI.Dialog.confirm({
            title: '退出',
            content: '是否确认退出登陆？',
            onConfirm: async () => {
                console.log('logout')
                // 清除用户信息
                React.Cookie.remove('Business');
                React.SetBusiness({});
                React.navigate('/business/login');
            },
        })
    }

    const onChangeEmail = () => {
        if (React.Business.auth == '1') {
            React.UI.Toast.show('邮箱已认证,无需再次认证');
            return false;
        }

        React.navigate('/business/email');

    }

    return (
        <>
            <link rel="stylesheet" href="/assets/css/user.css"></link>
            <div className="header">
                <div className="userinfo">
                    <div className="avatar">
                        <img src={Business.avatar_text} alt="" />
                    </div>
                    <div className="nickname">{Business.nickname}</div>
                </div>
                <div className="corrugated">
                    <div className="wave-top wave-item"></div>
                    <div className="wave-middle wave-item"></div>
                    <div className="wave-bottom wave-item"></div>
                </div>
            </div>

            <div className="menu-cell">
                <div className="item">
                    <React.Router.NavLink to="/business/profile">
                        <div className="title">个人资料</div>
                        <div className="icon">
                            <img src="/assets/images/right.png" alt="" />
                        </div>
                    </React.Router.NavLink>
                </div>
                <div className="item">
                    <a onClick={onChangeEmail}>
                        <div className="title">邮箱认证</div>
                        <div className="icon">
                            <img src="/assets/images/right.png" alt="" />
                        </div>
                    </a>
                </div>
                <div className="item">
                    <React.Router.NavLink to="/guest/index" >
                        <div className="title">住客信息</div>
                        <div className="icon">
                            <img src="/assets/images/right.png" alt="" />
                        </div>
                    </React.Router.NavLink>
                </div>
                <div className="item">
                    <React.Router.NavLink to="/order/index" >
                        <div className="title">房间订单</div>
                        <div className="icon">
                            <img src="/assets/images/right.png" alt="" />
                        </div>
                    </React.Router.NavLink>
                </div>
                <div className="item">
                    <React.Router.NavLink to="/business/coupon" >
                        <div className="title">我的优惠券</div>
                        <div className="icon">
                            <img src="/assets/images/right.png" alt="" />
                        </div>
                    </React.Router.NavLink>
                </div>
                <div className="item">
                    <React.Router.NavLink to="/business/about" >
                        <div className="title">关于我们</div>
                        <div className="icon">
                            <img src="/assets/images/right.png" alt="" />
                        </div>
                    </React.Router.NavLink>
                </div>
                <div className="item">
                    <a onClick={logout}>
                        <div className="title">退出登陆</div>
                        <div className="icon">
                            <img src="/assets/images/right.png" alt="" />
                        </div>
                    </a>
                </div>
            </div>
            <Menu />
        </>
    )
}

export default BusinessIndex;